# coding=UTF-8
import math
def deal_Rotation(data):
    for i in range(len(data)):
        data[i] = data[i] - data[i][0]# 平移手
        A = data[i][4] - data[i][0] # 取A向量
        mod = math.sqrt(A[0] ** 2 + A[2] ** 2)        # 计算x轴与A向量在x,y平面上的投影的cos,sin值
        cos = A[0] / mod
        sin = A[2] / mod
        data[i][:, 0], data[i][:, 2] = data[i][:, 0] * cos + data[i][:, 2] * sin, data[i][:, 2] * cos - data[i][:, 0] * sin       # 绕x轴旋转
        A = data[i][4] - data[i][0] # 计算在x,z平面上的投影
        mod = math.sqrt(A[0] ** 2 + A[1] ** 2)        # 计算x轴与A向量在x,z平面上的投影的cos,sin值
        cos = A[0] / mod
        sin = A[1] / mod
        data[i][:, 0], data[i][:, 1] = data[i][:, 0] * cos + data[i][:, 1] * sin, data[i][:, 1] * cos - data[i][:, 0] * sin        # 绕y轴旋转
        
    return data